package tests;

import static org.junit.Assert.*;

import java.util.ArrayList;

import main.Conference;
import main.Manuscript;
import main.Review;

import org.junit.Before;
import org.junit.Test;

/**
 * JUnit tests for remove review
 * 
 * @author Amandeep Jhajj
 * Holly changed 11/28 to reflect updated parameters.
 * @version 11/28
 */
public class RemoveReviewTest {
	Conference conf;
	Review rev;
	Manuscript manu;
	
	/**
	 * Initializes objects used in tests.
	 */
	@Before
	public void setUp() {
		conf = new Conference();
		rev = new Review();
		manu = new Manuscript();
		for (int i = 0; i < 5; i++){
			if(i != 2)
				conf.addReview(manu, new Review());	
			else
				conf.addReview(manu, rev);
		}
	}
	
	/**
	 * @author Amandeep Jhajj
	 * test to make sure that the removeReview method works.
	 */
	@Test
	public void testRemoveReview(){
		ArrayList<Review> reviews = manu.getReviews();
		int size = reviews.size(); // this should be 5
		assertEquals("wrong size", size, 5);
		boolean hasRev = reviews.contains(rev);
		assertTrue("Rev was not in the reviews", hasRev);
		conf.deleteReview(manu, rev); // here we're attempting to delete rev from the Conferece
		hasRev = reviews.contains(rev);
		assertFalse("Rev was not deleted", size == reviews.size());
		assertFalse("Rev was not deleted", hasRev);	
	}
}
